using System;
using System.Collections.ObjectModel;
using ProdControls.Bridges;
using ProdControls.Interfaces;

namespace ProdControls
{
    /// <summary>
    ///   Methods to work with RadioButton controls using the UI Automation framework
    /// </summary>
    public sealed class ProdRadioButton : BaseProdControl, ISelectionItem, IInvoke
    {
        #region Constructors

        /// <summary>
        ///   Initializes a new instance of the ProdRadioButton class.
        /// </summary>
        /// <param name="prodWindow"> The ProdWindow that contains this control. </param>
        /// <param name="automationId"> The UI Automation element </param>
        /// <remarks>
        ///   Will attempt to match AutomationId, then ReadOnly
        /// </remarks>
        public ProdRadioButton(ProdWindow prodWindow, string automationId)
            : base(prodWindow, automationId)
        {
        }

        /// <summary>
        ///   Initializes a new instance of the ProdRadioButton class.
        /// </summary>
        /// <param name="prodWindow"> The ProdWindow that contains this control. </param>
        /// <param name="treePosition"> The index of this control in the parent windows UI control tree. </param>
        public ProdRadioButton(ProdWindow prodWindow, int treePosition)
            : base(prodWindow, treePosition)
        {
        }

        /// <summary>
        ///   Initializes a new instance of the ProdRadioButton class.
        /// </summary>
        /// <param name="prodWindow"> The ProdWindow that contains this control. </param>
        /// <param name="controlHandle"> Window handle of the control </param>
        public ProdRadioButton(ProdWindow prodWindow, IntPtr controlHandle)
            : base(prodWindow, controlHandle)
        {
        }

        #endregion Constructors

        #region IInvoke Members

        public void Invoke()
        {
            this.InvokeHook(this);
        }

        #endregion



        public bool IsSelected(string text)
        {
            return this.IsSelectedHook(this, text);
        }

        public bool IsSelected(int index)
        {
            return this.IsSelectedHook(this, index);
        }

        public void Select(string text)
        {
            this.SelectHook(this,text);
        }

        public void Select(int index)
        {
            this.SelectHook(this, index);
        }
    }
}